#ifndef __FRRMWARE_H
#define __FRRMWARE_H	

#include <stdint.h>
#include <stdio.h>

#define max_pack_len 2048

#define OTAMSGERR_MODEL     0xFFFFFFFF
#define OTAMSGERR_VERSION   0xFFFFFFFE
#define OTAMSGERR_OTHER     0xFFFFFFF0

typedef struct 
{
	uint32_t model;
	uint32_t version;
	uint32_t buildtime;
	uint32_t crc32val;
	uint32_t file_len;
	uint32_t data_len;
	uint32_t region_idx;
	uint32_t flash_bak_base;
	uint32_t flash_data[max_pack_len/4];
}updata_bak_region;
#define BAK_REGION_LEN (sizeof(updata_bak_region))
#define BAK_REGION_HEAD_LEN (4*8)





void firmware_write_flash(uint32_t write_addr, updata_bak_region *firmware, uint32_t total_rlen);
void msg_firmware_handle(uint8_t *msg_buf, uint32_t msg_len);



#endif

